g = input()
flag = True
h = []
for char in g:
    if char in '([{<':
        h.append(char)
    elif char in ')]}>':
        if not h:
            flag = False
            break
        elif ord(char) - ord(b[-1]) in (1, 2):
            h.pop()
        else:
            flag = False
            break

if flag and not h:
    print("Yes")
else:
    print("No")
